'use strict';

const Controller = require('egg').Controller;

class IsloginController extends Controller {
  async islogin() {
    const { ctx } = this;
  
    let flag = await this.ctx.service.persenal.islogin()
        if (flag) {
            // 获取缓存中的邮箱
            let email=this.ctx.session.email
            console.log(email);
            // 通过邮箱查询用户表
            let usersql1=`SELECT * FROM personal WHERE email="${email}"`
            let user1 = await this.app.mysql.query(usersql1)
            console.log(user1,99);



            this.ctx.body = {
                info: "登录成功",
                code: 2002,
                userInfo: user1
            }
        } else {
            this.ctx.body = {
                info: "未登录",
                code: 4004
            }
        }
    
  }

}

module.exports = IsloginController;
